//
// Created by djy on 2019/7/24.
//

#ifndef CLION_CODE_VIRTUAL_FLASH_H
#define CLION_CODE_VIRTUAL_FLASH_H

#include <stdint.h>

#define  FLASH_START_ADDR     (0)
#define  FLASH_SIZE           (4*1024)

#define PARA_ADDR				FLASH_START_ADDR
#define PARA_SIZE               (2*1024)
#define SENSOR_ARCHIVES_ADDR	(PARA_ADDR + PARA_SIZE)
#define SENSOR_ARCHIVES_SIZE    (2*1024)

int disk_erase(uint32_t start, uint32_t size);
int disk_write(uint32_t start, const void *data, uint32_t size);
int disk_read(uint32_t start, void *data, uint32_t size);

void  flash_init();
void  flash_erase(uint32_t start_addr,uint32_t dala_len);
void  flash_read(uint8_t buff[], uint32_t read_addr, uint32_t data_len);
int  flash_write(uint8_t buff[], uint32_t write_addr, uint32_t data_len);


#endif //CLION_CODE_VIRTUAL_FLASH_H
